package com.cloud.security.core.authentication;

import com.cloud.security.core.service.DefaultUserDetailsServiceImpl;
import com.cloud.security.core.service.ProUserDetailsService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * 认证相关的扩展点配置。配置在这里的bean，业务系统都可以通过声明同类型或同名的bean来覆盖安全
 * 模块默认的配置
 * @author Aijm
 * @since 2019/5/27
 */
@Configuration
public class AuthenticationBeanConfig {

	/**
	 * 默认密码处理器
	 *
	 * @return 密码加密器
	 */
	@Bean
	@ConditionalOnMissingBean(PasswordEncoder.class)
	public BCryptPasswordEncoder passwordEncoder() {
		return new BCryptPasswordEncoder();
	}

//	/**
//	 * 默认认证器
//	 *
//	 * @return user details service
//	 */
//	@Bean
//	@ConditionalOnMissingBean(UserDetailsService.class)
//	public ProUserDetailsService userDetailsService() {
//		return new DefaultUserDetailsServiceImpl();
//	}


}
